﻿Imports System.Windows.Forms
Imports System.Drawing
Imports System.ComponentModel

''' <summary>
'''     This class is a workaround for a known VS2005 SplitContainer bug.
'''     The designer will set Panel2MinSize before setting the control Size, 
'''     and this causes a exception to be thrown.  
'''     The solution used here is to store the Panel2MinSize and set it in after the size is set.
'''     Use this code at your own risk, as I make no warrenty of any kind. 
'''     You are free to use this code however you like.
''' </summary>
Class AnguloSplitContainer
    Inherits SplitContainer

    Public Sub New()
        m_panel2MinSize = MyBase.Panel2MinSize
    End Sub

    Public Shadows Property Panel2MinSize() As Integer
        Get
            If isSized Then
                Return MyBase.Panel2MinSize
            End If
            Return m_panel2MinSize
        End Get
        Set(ByVal value As Integer)
            m_panel2MinSize = value
            If isSized Then
                MyBase.Panel2MinSize = m_panel2MinSize
            End If
        End Set
    End Property

    Public Shadows Property Size() As Size
        Get
            Return MyBase.Size
        End Get
        Set(ByVal value As Size)
            MyBase.Size = value
            If Not isSized Then
                isSized = True
                If m_panel2MinSize <> 0 Then
                    Panel2MinSize = m_panel2MinSize
                End If
            End If
        End Set
    End Property

    Private m_panel2MinSize As Integer
    Private isSized As Boolean = False
End Class